import wmi


def system_spec():
    pc = wmi.WMI()
    os_info = pc.Win32_OperatingSystem()[0]
    processor = pc.Win32_Processor()[0]
    gpu = pc.Win32_VideoController()[0]
    os_name = os_info.Name.encode('utf-8').split(b'|')[0]
    ram = float(os_info.TotalVisibleMemorySize) / 1048576

    print(f'操作系统: {os_name}')
    print(f'CPU: {processor.Name}')
    print(f'内存: {ram} GB')
    print(f'显卡: {gpu.Name}')

    print("\n计算机信息如上 ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑")


if __name__ == '__main__':
    system_spec()
